package user

import (
	"context"

	v1 "gf-xb-api/api/user/v1"
	"gf-xb-api/internal/service"
	"gf-xb-api/utility/xpointer"
)

func (c *ControllerV1) Enable(ctx context.Context, req *v1.EnableReq) (res *v1.EnableRes, err error) {
	var bFalse = xpointer.GetPointer(false)

	output, err := service.User().Enable(ctx, req.Username)
	if err != nil {
		return (*v1.EnableRes)(bFalse), err
	}

	return (*v1.EnableRes)(&output), nil
}
